FIX: Sort out controls which are not contained in event for AnyButtonPressed event (ISXB-1005)#2249
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2249 +/- ##
===========================================
+ Coverage 76.70% 76.72% +0.01%
===========================================
Files 465 465
Lines 87919 87944 +25
===========================================
+ Hits 67442 67477 +35
+ Misses 20477 20467 -10 Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
jfreire-unity
approved these changes
Oct 2, 2025
Collaborator
jfreire-unity
left a comment
There was a problem hiding this comment.
Looks like a simple one liner and good to have yet another test for this!
|
|
||
| [Test] | ||
| [Category("Events")] | ||
| public void Events_OnAnyButtonPressed_FiltersOutOtherControls() |
Collaborator
There was a problem hiding this comment.
Great to have a test. I assume this test would fail before your change, right?
ekcoh
approved these changes
Oct 3, 2025
Collaborator
ekcoh
left a comment
There was a problem hiding this comment.
Looks good, thanks for looking into this.
Collaborator
|
Did not forget this one, taking a look today |
Pauliusd01
approved these changes
Oct 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue where InputSystem.anyButtonPress is triggered multiple times if another control of the same device is actuated while holding a button down. This is also reproducible on gamepads that receive events constantly, holding a button down then produces one anyButtonPress event per frame.
This was due to the fact that all controls of the device contained in the event were checked for actuated buttons, not only the control triggering the event. Then the magnitude check of the button causes the trigger of the callback over and over again.
This is prevented by the newly added line of code which checks if the control is the same as from the InputEvent.
This issue is fixed with the PR too.
Testing status & QA
Manual testing with Test project of customers.
Overall Product Risks
Low
Comments to reviewers
The documentation states that the callback is only triggered once per button press.
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.After merge: